#pragma once



namespace ljl
{
	template<class Iterator, class Ref, class Ptr>
	struct ReverseIterator
	{
		typedef ReverseIterator<Iterator, Ref, Ptr> self;

		ReverseIterator(Iterator it)
			:_it(it)
		{
		}

		Ref operator*()
		{
			Iterator tmp(_it);
			--tmp;
			return *tmp;
		}

		Ptr operator->()
		{
			return &(operator*());
		}
		self& operator++()
		{
			--_it;
			return *this;
		}
		self& operator--()
		{
			++_it;
			return *this;
		}


		bool operator!=(const self& it) const
		{
			return _it != it._it;
		}

		bool operator==(const self& it) const
		{
			return _it == it._it;
		}

		Iterator _it;
	};

}
